import Vue from "vue";
import VueRouter from "vue-router";
import MainView from "@/views/MainView.vue";
import { component } from "vue/types/umd";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "home",
    component: MainView,
    redirect: "/home/ArcGisCore",
    children: [
      {
        path: "ArcGisCore",
        name: "ArcGisCore",
        component: () => import("@/views/ArcGisCore/index.vue"),
      },
      {
        path: "ArcGisEsri",
        name: "ArcGisEsri",
        component: () => import("@/views/EsriLoader/index.vue"),
      },
      {
        path: "WuHanMap",
        name: "WuHanMap",
        component: () => import("@/views/WuHanGis/index.vue"),
      },
      {
        path: "EsriLayer",
        name: "EsriLayer",
        component: () => import("@/views/EsriLayer/index.vue"),
      },
      {
        path: "Flow",
        name: "Flow",
        component: () => import("@/views/Flow/index.vue"),
      },
      {
        path: "WeatherMap",
        name: "WeatherMap",
        component: () => import("@/views/WeatherGis/index.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
